<template>
    <div>
        <el-button @click="loadData()">查询</el-button>
        <el-table
                :data="tableData"
                stripe
                style="width: 100%">
            <el-table-column
                    label="序号"
                    prop="id"
                    width="50">
            </el-table-column>
            <el-table-column
                    label="姓名"
                    prop="name"
                    width="180">
            </el-table-column>
            <el-table-column
                    label="品质"
                    prop="levelDesc"
                    width="80">
            </el-table-column>
            <el-table-column
                    label="来源"
                    prop="source"
                    width="80">
            </el-table-column>
            <el-table-column
                    label="出处"
                    prop="sourceDesc"
                    width="150">
            </el-table-column>
            <el-table-column
                    label="等级"
                    prop="sourceLevel"
                    width="120">
            </el-table-column>
            <el-table-column
                    label="观赏"
                    prop="guanShang"
                    sortable
                    width="120">
            </el-table-column>
            <el-table-column
                    label="实用"
                    prop="shiYong"
                    sortable
                    width="120">
            </el-table-column>
            <el-table-column
                    label="景观"
                    prop="jianGu"
                    sortable
                    width="120">
            </el-table-column>
            <el-table-column
                    label="风水"
                    prop="fengShui"
                    sortable
                    width="120">
            </el-table-column>
            <el-table-column
                    label="趣味"
                    prop="quWei"
                    sortable
                    width="120">
            </el-table-column>
        </el-table>
        <el-pagination
                :current-page.sync="currentPage"
                :page-size.sync="pageSize"
                :total="total"
                background
                layout="prev, pager, next">
        </el-pagination>
    </div>
</template>

<script>
    import {loadData} from "@/components/common/method-transmit";

    export default {
        name: "CmsMain",
        methods: {
            async loadData() {
                var result = await loadData(this.currentPage++, this.pageSize, this.searchForm, this.url)
                if (result.success) {
                    this.tableData = result.data.data.data.records
                } else {
                    this.$message({
                        type: 'error',
                        message: '网络连接错误，请稍后重试  ' + result.data
                    });
                }
            }
        },
        data() {
            return {
                url: '/furniture',
                currentPage: 1,
                pageSize: 10,
                total: 1,
                searchForm: {
                    name: '',
                    order: 0,
                    level: '',
                    source: ''
                },
                tableData: []
            }
        }
    }
</script>

<style scoped>

</style>